﻿using EFCore.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SIService;
using SService;

namespace WMSWeb.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class OutboundController : ControllerBase
    {
        private readonly WmssystemContext myDb;
        private readonly OutboundS outboundS;

        public OutboundController(WmssystemContext myDb, SService.OutboundS outboundS)
        {
            this.myDb = myDb;
            this.outboundS = outboundS;
        }
        /// <summary>
        /// 4个条件分页查询
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<PO_Outbound>> Fye(int pageSize, int currentPage, string Number = null, string Type = null, string Status = null, string WName = null)
        {

            return await outboundS.Fye(pageSize, currentPage, Number, Type, Status, WName);
        }
        [HttpGet]
        public async Task<List<PO_Outbound>> Qu()
        {
            return await outboundS.Qu();
        }
        /// <summary>
        /// 查询销售订单和客户表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<PO_Salesorder>> Xsqu()
        {
            return await outboundS.Xsqu();
        }
        /// <summary>
        /// 查询销售订单和客户表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<PO_Salesorder>> Xsqu1()
        {
            return await outboundS.Xsqu1();
        }
        /// <summary>
        /// 出库管理添加数据
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> Add(PO_Outbound pO_Outbound)
        {
            return await outboundS.Add(pO_Outbound);
        }
        /// <summary>
        /// 出库管理审核
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> CkShen(PO_Outbound pO_Outbound, string to)
        {
            return await outboundS.CkShen(pO_Outbound, to);
        }
        /// <summary>
        /// 出库管理,销售订单出库
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> Upd(PO_Salesorder pO_Salesorder)
        {
            return await outboundS.Upd(pO_Salesorder);
        }
        /// <summary>
        /// 出库管理批量删除
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpDelete]
        public async Task<int> CkDel(List<int> Ids)
        {
            return await outboundS.CkDel(Ids);
        }
        /// <summary>
        /// 出库管理修改
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> Upd1(PO_Outbound pO_Outbound)
        {
            return await outboundS.Upd1(pO_Outbound);
        }
    }
}
